Skip to content

ci: open an issue if a scheduled workflow fails#2627

Open
tonyandrewmeyer wants to merge 4 commits into
canonical:mainfrom
tonyandrewmeyer:rainy/2424-scheduled-workflow-notifications
Open

ci: open an issue if a scheduled workflow fails#2627
tonyandrewmeyer wants to merge 4 commits into
canonical:mainfrom
tonyandrewmeyer:rainy/2424-scheduled-workflow-notifications

Conversation

@tonyandrewmeyer

@tonyandrewmeyer tonyandrewmeyer commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

For each of our workflows that runs on a schedule, if the scheduled run fails, open an issue. This ensures everyone is aware and that there is tracking in GitHub, rather than just an email to the person that most recently set the schedule.

This uses the approach from Jubilant, where it's a new issue every time, rather than updating an existing one. The title and body are quite bare-boned, like Jubilant, but we could adjust that as needed. In practice, I think what we need is the discipline to promptly investigate opened issues (which were not doing a great job of in Jubilant) and convert them into detailed reports of the specific failure, and then close as duplicates new ones if needed. Alternatively, we could throw in some AI to investigate them and convert them into a detailed investigation.

I haven't tested this, but it's very strongly based on the Jubilant one, which has had several executions already. Testing would need to be done on my fork, but I can if desired.

Refs #2424

tonyandrewmeyer and others added 2 commits July 6, 2026 12:53
Adds an open-issue-on-failure-if-scheduled job to each in-scope
scheduled workflow so failures during a cron-triggered run produce
a tracking issue, rather than relying on email to whoever last
edited the schedule (per canonical#2424).

Covers: integration, smoke, example-charm-integration-tests,
example-charm-charmcraft-test, tiobe, update-best-practice-doc,
update-charm-tests.

Skipped: published-charms-tests (regularly fails, per the issue
description noting it should be handled separately).

Fixes canonical#2424
The seven callers now delegate to `.github/workflows/notify-scheduled-failure.yml`
via `uses:`. Each caller keeps its `if:` gate, `needs:`, and `permissions:`;
the shared `steps` block moves into the reusable workflow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All other workflows in this repo use the `.yaml` extension.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@tonyandrewmeyer tonyandrewmeyer force-pushed the rainy/2424-scheduled-workflow-notifications branch from d88de54 to 4465ee9 Compare July 6, 2026 02:22

@james-garner-canonical james-garner-canonical left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, it'll be interesting to see how this works out with a lot more separate workflows.


open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [collect-spread-jobs, integration]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
needs: [collect-spread-jobs, integration]
needs: [integration]


open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [collect, integration]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
needs: [collect, integration]
needs: [integration]

- name: Create issue on failure
env:
GH_TOKEN: ${{ github.token }}
WORKFLOW_NAME: ${{ github.workflow }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_NAME: ${{ github.workflow }} # The workflow that called this one.

@tromai tromai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me. Thank you.

I agree with James on adding a small comment to WORKFLOW_NAME: ${{ github.workflow }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants